import java.util.Hashtable;
import java.util.Map.Entry;

import Utils.SortUtils;

public class HashUtils {
	public static Hashtable<String, Integer> countHash(Hashtable<String, Integer> word_count, String key) {
		if (word_count.containsKey(key))
			word_count.put(key, word_count.get(key) + 1);
		else
			word_count.put(key, 1);
		return word_count;
	}

	public static void printHash(Hashtable<String, Integer> key_value) {
		Entry[] entries = SortUtils.sortedHashtableByValue(key_value, -1);
		for (Entry entry : entries) {
			System.out.println(entry.getKey() + "," + entry.getValue());
		}

	}

}
